package com.xuecheng.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xuecheng.order.entity.Orders;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单 Mapper 接口
 * </p>
 *
 * @author itcast
 */
public interface OrdersMapper extends BaseMapper<Orders> {

    /**
     * <p>
     *  查询10分钟内的未支付订单
     * </p>
     *
     * @return List<Orders>
     */
    @Select("select * from orders where create_date >=DATE_SUB(NOW(),INTERVAL 10 MINUTE)\n" +
            "and `status` = \"600001\"")
    List<Orders> selectUnpaidOrders();

    /**
     * <p>
     *  一天一次 查询所有未支付订单
     * </p>
     * @return List<Orders>
     */
    @Select("select * from orders where `status` = \"600001\"")
    List<Orders> selectAllOrders();
}
